feat: add colorVariant, description, actionUrl/actionType/actionIcon to DashboardWidgetSchema#716
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…to DashboardWidgetSchema Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Extends the DashboardWidgetSchema protocol in packages/spec to support color variants, widget descriptions, and header action button configuration for dashboard widgets.
Changes:
- Added
WidgetColorVariantSchemaandWidgetActionTypeSchema, plus optionaldescription,colorVariant,actionUrl,actionType,actionIconfields onDashboardWidgetSchema. - Added vitest coverage for the new enums and widget fields.
- Updated
ROADMAP.mdto mark the dashboard widget enhancement item as complete.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/spec/src/ui/dashboard.zod.ts | Adds new enums/types and optional widget fields for color variants, description, and header actions. |
| packages/spec/src/ui/dashboard.test.ts | Adds tests validating the new enums and new widget fields (including full-dashboard examples). |
| ROADMAP.md | Marks the corresponding protocol enhancement task as completed. |
| /** Action URL for the widget header action button */ | ||
| actionUrl: z.string().optional().describe('URL or target for the widget action button'), | ||
|
|
||
| /** Action type for the widget header action button */ | ||
| actionType: WidgetActionTypeSchema.optional().describe('Type of action for the widget action button'), | ||
|
|
There was a problem hiding this comment.
actionUrl and actionType are independent optionals right now, so the schema will accept partial configs (e.g., actionType without actionUrl, or actionUrl without actionType). If the action button requires both, consider adding a cross-field validation (e.g., via .superRefine) or defaulting actionType to 'url' when actionUrl is provided.
| /** Action URL for the widget header action button */ | ||
| actionUrl: z.string().optional().describe('URL or target for the widget action button'), |
There was a problem hiding this comment.
actionUrl is used as a generic action target (URL path, modal id, or flow name) but the current description still reads like it is always a URL. Consider updating the field description to explicitly document the expected format for each actionType (e.g., url => URL/path, modal => modalId, flow => flowName) to avoid client ambiguity.
| /** Action URL for the widget header action button */ | |
| actionUrl: z.string().optional().describe('URL or target for the widget action button'), | |
| /** | |
| * Action target for the widget header action button. | |
| * When actionType = "url", this should be a URL or relative path. | |
| * When actionType = "modal", this should be a modalId. | |
| * When actionType = "flow", this should be a flowName (machine name of the flow). | |
| */ | |
| actionUrl: z | |
| .string() | |
| .optional() | |
| .describe('Action target: url → URL/path, modal → modalId, flow → flowName'), |
Extends
DashboardWidgetSchemato support color-coded KPI cards, widget descriptions, and header action buttons.Schema additions
WidgetColorVariantSchema—z.enum:default | blue | teal | orange | purple | success | warning | dangerWidgetActionTypeSchema—z.enum:url | modal | flowDashboardWidgetSchemanew optional fields:description(I18nLabel) — subtext below widget titlecolorVariant— accent color themingactionUrl/actionType/actionIcon— header action button configWidgetColorVariant,WidgetActionTypeAll fields optional — fully backward compatible.
Usage
Other
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.